from django.http import JsonResponse
from game.models.player import Player


def getinfo_acapp(request):
    pass


def getinfo_web(request):
    user = request.user
    print("profile me: ", user)
    if not user.is_authenticated:
        return JsonResponse({
            "result": "not login"
        })
    player = Player.objects.all()[0]
    return JsonResponse({
        "result": "success",
        "username": player.user.username,
        "photo": player.head_url,
    })


def profile_me(request):
    platform = request.GET.get('platform')
    if platform == 'ACAPP':
        return getinfo_acapp(request)
    else:
        return getinfo_web(request)
